//
//  PayCell.m
//  预购清单
//
//  Created by  on 2022/10/16.
//

#import "PayCell.h"
@interface PayCell()
@property (strong, nonatomic) IBOutlet UIView *bgview;
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *num;
@property (strong, nonatomic) IBOutlet UIButton *selectBt;
@property (strong, nonatomic) IBOutlet UILabel *time;

@end
@implementation PayCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bgview.layer.masksToBounds = NO;
    self.bgview.layer.shadowColor = [@"#9B9B9B" color:0.2].CGColor;
    self.bgview.layer.shadowOffset = CGSizeMake(0, 2);
    self.bgview.layer.shadowRadius = 3;
    self.bgview.layer.cornerRadius = 20;
    self.bgview.layer.shadowOpacity = 1;
}
- (void)setModel:(Prepay *)model{
    _model = model;
    self.img.image = [UIImage imageWithData:model.type.img];
    self.time.text = [NSString stringWithFormat:@"%2d.%2d",[self.model.month intValue],[self.model.day intValue]];
    self.name.text = LS(self.model.type.name);
    self.num.text = [NSString stringWithFormat:@"-%@%0.2f",LS(@"¥"),self.model.money];
    self.selectBt.selected = self.model.select;
    self.selectBt.hidden = self.model.payed;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
- (IBAction)actionForBtn:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.model.select = !self.model.select;
    if (self.block) {
        self.block();
    }
}

@end
